# import numpy as np
# axis_min axis_max
# a = np.array([[3, 7, 5], [8, 4, 3], [2, 4, 9]])
# print('我们的数组是：')
# print(a)
# print('\n')
# print('调用 amin() 函数：')
# print(np.amin(a, axis=1))
# print('\n')
# print('再次调用 amin() 函数：')
# print(np.amin(a, axis=0))
# print('\n')
# print('调用 amax() 函数：')
# print(np.amax(a))
# print('\n')
# print('再次调用 amax() 函数：')
# print(np.amax(a, axis=0))
# print(np.amin(a))
# import numpy as np

# import numpy as np
#
# a = np.array([[3, 7, 5], [8, 4, 3], [2, 4, 9]])
# print('我们的数组是：')
# print(a)
# print('\n')
# print('调用 ptp() 函数：')
# # max - min
# print(np.ptp(a))
# print('\n')
# print('沿轴 1 调用 ptp() 函数：')
# print(np.ptp(a, axis=1))
# print('\n')
# print('沿轴 0 调用 ptp() 函数：')
# print(np.ptp(a, axis=0))

# import numpy as np
#
# a = np.array([[10, 7, 4], [3, 2, 1]])
# print('我们的数组是：')
# print(a)
#
# print('调用 percentile() 函数：')
# # 50% 的分位数，就是 a 里排序之后的中位数
# print(np.percentile(a, 50))
#
# # axis 为 0，在纵列上求
# print(np.percentile(a, 50, axis=0))
#
# # axis 为 1，在横行上求
# print(np.percentile(a, 50, axis=1))
#
# # 保持维度不变
# print(np.percentile(a, 50, axis=1, keepdims=True))

# import numpy as np
#
# a = np.array([[30, 65, 70], [80, 95, 10], [50, 90, 60]])
# print('我们的数组是：')
# print(a)
# print('\n')
# print('调用 median() 函数：')
# print(np.median(a))
# print('\n')
# print('沿轴 0 调用 median() 函数：')
# print(np.median(a, axis=0))
# print('\n')
# print('沿轴 1 调用 median() 函数：')
# print(np.median(a, axis=1))

# import numpy as np
# # 求中位数，会先排序
# a = np.array([[30, 65, 70], [80, 95, 10], [50, 90, 60]])
# print(np.median(a))
# print(np.median(a, axis=0))
# print(np.median(a, axis=1))

# import numpy as np
# a = np.array([[30, 65, 70], [80, 95, 10], [50, 90, 60]])
# print(np.mean(a))
# print(np.mean(a, axis=0))
# print(np.mean(a, axis=1))

# 加权平均数
# [num] * [num_weight] / sum(nums_weight)
# import numpy as np
#
# a = np.array([1, 2, 3, 4])
# print('我们的数组是：')
# print(a)
# print('调用 average() 函数：')
# print(np.average(a))
# # 不指定权重时相当于 mean 函数
# wts = np.array([4, 3, 2, 1])
# print('再次调用 average() 函数：')
# print(np.average(a, weights=wts))
# # 如果 returned 参数设为 true，则返回权重的和
# print('权重的和：')
# print(np.average([1, 2, 3, 4], weights=[4, 3, 2, 1], returned=True))

# import numpy as np
#
# a = np.arange(6).reshape(3, 2)
# print('我们的数组是：')
# print(a)
# print('\n')
# print('修改后的数组：')
# wt = np.array([3, 5])
# print(np.average(a, axis=1, weights=wt))
# print('\n')
# print('修改后的数组：')
# print(np.average(a, axis=1, weights=wt, returned=True))

import numpy as np
# 方差
print(np.var([1, 2, 3, 4]))
# 标准差
print(np.std([1, 2, 3, 4]))